import React, { Component } from 'react'
import "./want.css"
import { Link } from "react-router-dom"
import { LeftOutlined,ArrowDownOutlined } from '@ant-design/icons';
import axios from "axios"
import Item from 'antd/lib/list/Item';
import {shopcar} from "../../api/shopOrder"



let information = [
    {
        img_url:"https://img1.baidu.com/it/u=2562841123,2101060777&fm=26&fmt=auto&gp=0.jpg"
    }
]

export default class want extends Component {

    constructor(){
        super()
        this.state={
            shopList:[
                
            ]
        }
    }

getChange=()=>{
    shopcar({
        uid:localStorage.getItem("uid")
    }).then(res=>{
        this.state.shopList = res.data
        console.log(this.state.shopList,"shopList")
        this.setState({})
    })
    // axios.get('/api/nice/order/queryAllOrders',{params}).then(res=>{
    //     console.log(res)
    //     information = res
    // })
}
buyIt(item){
    console.log(item)
}
componentDidMount(){
    this.getChange()
}
    render() {
        
        return (
            <div>
                <div className="wantHeader">
                    <Link to="/Mine" className="wantBack">
                        <LeftOutlined />
                    </Link>
                    <span>
                        想要的nice好货
                    </span>
                </div>
                <div className="wantMain">
                    <h2>
                        <div>商品</div>
                        <div>当前最低售价</div>
                    </h2>
                    <div>
                        {this.state.shopList.length && this.state.shopList.map((item,i)=>
                        <div key={i} onClick={()=>{this.buyIt(item)}}>
                            <div className="wantPreview">
                                <div>
                                    <img alt="" src={item.productCustomer.photos[0].path} />
                                </div>
                                <div className="wantContent">

                                        <div className="wantShopName">
                                        {item.productCustomer.pname}
                                        </div>
                                        <div className="wantCode">
                                            <span>
                                                {item.productCustomer.brand}
                                                </span>
                                            <span>
                                                {item.size}码
                                            </span>
                                        </div>
                                </div>
                                <div className="wantPrice">
                                    <div>￥{item.productCustomer.price}</div>
                                    <span><ArrowDownOutlined/>￥170</span>
                                </div>
                            </div>
                        </div>
                        )}
                    </div>
                </div>
            </div>
        )
    }
}
